﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_ACEIndex.cshtml";
}
@this.Partial("Index-js")
<script>
    var workflowList = @this.Raw(this.ViewBag.WorkflowListString);
    var workflownodeList=@this.RawSerialize(this.ViewBag.WorkflownodeList)
</script>
<div class="topPanel">
    <div class="toolbar">
        <div class="btn-group">
            <a class="btn btn-primary" onclick="$ace.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
        </div>
        <div class="btn-group">
            <button class="btn btn-primary" data-bind="click:Edit,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>修改</button>
            <button class="btn btn-primary" data-bind="click:Delete,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-trash-o"></i>删除</button>
            <button class="btn btn-primary" data-bind="click:Add"><i class="fa fa-plus"></i>添加</button>
         <button class="btn btn-primary" data-bind="click:Detail,attr:{disabled:!DataTable.SelectedModel()}"><i class="fa fa-pencil-square-o"></i>详情</button>

        </div>
    </div>
    <div class="search">
        <table>
            <tr>
                <td>
                    <div class="input-group">
                        <input id="txt_keyword" type="text" class="form-control" placeholder="id/节点动作名称" style="width: 200px;" data-bind="value:SearchModel().keyword">
                        <span class="input-group-btn">
                            <button id="btn_search" type="button" class="btn  btn-primary" data-bind="click:Search"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>


<div class="table-responsive">
    <table class="table table-hover" data-bind="with:DataTable">
        <thead>
            <tr>
                <th style="width:20px;"></th>
                <th>id</th>
                 <th>工作流</th>
                <th>动作名称</th>
                <th>动作描述</th>
                <th>节点类型</th>
                <th>当前节点</th>
                <th>下一节点</th>
                <th>状态</th>
                <th>开始时间</th>
                 <th>结束时间</th> 
                <th>节点动作条件</th>
                 <th>锁定状态</th>
                <th>节点动作编码</th>
            </tr>
        </thead>

        <tbody data-bind="foreach:Models">
            <tr data-bind="click:$parent.SelectRow">
                <td data-bind="text:$parent.GetOrdinal($index())"></td>
                <td data-bind="text:id"></td>
                <td data-bind="text:$ace.getOptionTextByValue(workflowList,wfid())"></td>
                <td data-bind="text:nodeactionname"></td>
                <td data-bind="text:nodeactionmemo"></td>
                <td data-bind="text:nodetype()==1?'普通节点动作':'会签节点动作'"></td>
                <td data-bind="text:$ace.getOptionTextByValue(workflownodeList,currentnodeid(),'id','wfnodememo')"></td>
                <td data-bind="text:$ace.getOptionTextByValue(workflownodeList,nextnodeid(),'id','wfnodememo')"></td>
                <td data-bind="text:nastatus()==1?'已启用':'未启用'"></td>
                <td data-bind="dateString:begintime"></td>
                <td data-bind="dateString:endtime"></td>
                <td data-bind="text:nacondition"></td>
                <td data-bind="text:nalock()==1?'未锁定':'已锁定'"></td>
                <td data-bind="text:nodeactioncode"></td>
            </tr>
        </tbody>
        @this.Partial("_tfoot")
    </table>
</div>


@using (Html.Dialog("DetailDialog", "DetailDialog", 800))
{
         <form id="DetailForm">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form">
                    <tr>
                        <td class="formTitle">动作名称：</td>
                        <td class="formValue">
                           <label class="form-control" data-bind="text:Model().nodeactionname"></label>
                        </td>
                        <td class="formTitle">动作描述:</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().nodeactionmemo"></label>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">动作类型：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().nodetype==1?'普通节点动作':'会签节点动作'"></label>
                        </td>
                        <td class="formTitle">所属工作流：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:$ace.getOptionTextByValue(workflowList,Model().wfid)"></label>
                        </td>
                    </tr>
                  <tr>
                        <td class="formTitle">当前节点：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:$ace.getOptionTextByValue(workflownodeList,Model().currentnodeid,'id','wfnodememo')"></label>
                        </td>
                        <td class="formTitle">下一节点：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:$ace.getOptionTextByValue(workflownodeList,Model().nextnodeid,'id','wfnodememo')"></label>
                        </td>
                    </tr>

                        <tr>
                        <td class="formTitle">动作状态：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind=" text:Model().nastatus==1?'已启用':'未启用'"></label>
                        </td>
                    <td class="formTitle">动作锁定状态：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind=" text:Model().nalock==1?'未锁定':'已锁定'"></label>
                        </td>
                       
                    </tr>

                       <tr>
                        <td class="formTitle">开始时间：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind=" dateString:Model().begintime"></label>
                        </td>
                         <td class="formTitle">结束时间：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind=" dateString:Model().endtime"></label>
                        </td>
                    </tr>

                     <tr>
                        <td class="formTitle">动作条件：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().nacondition"></label>
                        </td>
                         <td class="formTitle">动作编码：</td>
                        <td class="formValue">
                            <label class="form-control" data-bind="text:Model().nodeactioncode"></label>
                        </td>
                       
                         
                </table>
            </div>
        </div>
    </form>
}

@using (Html.Dialog())
{

    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <table class="form"> 
                    <tr>
                        <td class="formTitle">动作名称</td>
                        <td class="formValue">
                            <input id="nodeactionname" name="nodeactionname" type="text" class="form-control" data-bind="value:Model().nodeactionname" />
                        </td>                       
                    </tr>
                    <tr>
                        <td class="formTitle">动作描述</td>
                        <td class="formValue">
                            <input id="nodeactionmemo" name="nodeactionmemo" type="text" class="form-control" data-bind="value:Model().nodeactionmemo" />
                        </td>                       
                    </tr>
                    <tr>
                       <td class="formTitle">动作类型</td>
                        <td class="formValue">
                         <select id="nodetype" name="nodetype" class="form-control " data-bind="value:Model().nodetype">
                            <option value="1" selected="selected" >普通节点动作</option>
                            <option value="2">会签节点动作</option>
                        </select>
                        </td> 
                    </tr>
                     <tr>
                       <td class="formTitle">所属工作流</td>
                        <td class="formValue">                        
                        <select id="wfid" name="wfid"class="form-control" data-bind="value:Model().wfid,event:{change:function(){OnWorkflowChange();}}">
                            @this.SelectOptions(this.ViewBag.WorkflowList)
                        </select>
                          
                        </td> 
                    </tr>
                    <tr>                        
                        <td class="formTitle">当前节点</td>
                        <td class="formValue">
                       <select id="currentnodeid" name="currentnodeid"class="form-control" data-bind="options:WorkflowNodeList,optionsText:'wfnodememo',optionsValue:'id', optionsCaption:'--请选择--',value:Model().currentnodeid">
                       </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle">下一节点</td>
                        <td class="formValue">
                            <select id="nextnodeid" name="nextnodeid"class="form-control" data-bind="options:WorkflowNodeList,optionsText:'wfnodememo',optionsValue:'id', optionsCaption:'--请选择--',value:Model().nextnodeid">
                       </select>
                        </td>                       
                    </tr>
                    <tr>
                        <td class="formTitle">动作状态</td>
                        <td class="formValue">
                           @* <input id="nastatus" name="nastatus" type="text" class="form-control" data-bind="value:Model().nastatus" />*@
                             <select id="nastatus" name="nastatus" class="form-control " data-bind="value:Model().nastatus">
                            <option value="1" selected="selected" >已启用</option>
                            <option value="2">未启用</option>
                            </select>
                        </td>                       
                    </tr>
                   
                     <tr>
                       <td class="formTitle">开始时间</td>
                        <td class="formValue">
                            <input id="begintime" name="begintime" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="value:Model().begintime" />
                        </td> 
                    </tr>
                       <tr>
                       <td class="formTitle">结束时间</td>
                        <td class="formValue">
                            <input id="endtime" name="endtime" type="text" class="form-control input-wdatepicker Wdate" onclick="WdatePicker({ dateFmt: 'yyyy-MM-dd' })" data-bind="value:Model().endtime" />
                        </td> 
                    </tr>
                       <tr>
                       <td class="formTitle">动作条件</td>
                        <td class="formValue">
                            <input id="nacondition" name="nacondition" type="text" class="form-control" data-bind="value:Model().nacondition" />
                        </td> 
                    </tr>
                     <tr>
                       <td class="formTitle">动作锁定状态</td>
                        <td class="formValue">
                          @*  <input id="nalock" name="nalock" type="text" class="form-control" data-bind="value:Model().nalock" />*@
                             <select id="nalock" name="nalock" class="form-control " data-bind="value:Model().nalock">
                            <option value="1" selected="selected" >未锁定</option>
                            <option value="2">已锁定</option>
                            </select>
                        </td> 
                    </tr>
                     <tr>
                       <td class="formTitle">动作编码</td>
                        <td class="formValue">
                            <input id="nodeactioncode" name="nodeactioncode" type="text" class="form-control" data-bind="value:Model().nodeactioncode" />
                        </td> 
                    </tr>
                </table>
            </div>
        </div>
    </form>


}

